<template>
  <div>
    <a-drawer
      :width="1200"
      :visible="visible"
      :maskClosable="true"
      @close="handleCancel"
      :destroyOnClose="true"
      :closable="false"
      :bodyStyle="{ padding: 0, background: '#f7f7f7', height: '100%' }"
    >
      <ContractDetail
        showType="drawer"
        :contractId="id"
        :discountType="type"
        @closeAllModal="closeAllModal"
      />
    </a-drawer>
  </div>
</template>
<script>
import { defineComponent, computed } from "vue";
import ContractDetail from "@/views/contract/ContractDetail/index.vue";

export default defineComponent({
  name: "ContractDetailDrawer",
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    // 合同id
    id: {
      type: [Number, String],
      default: 0,
    },
    discountType: {
      type: String,
      default: "",
    },
  },
  components: { ContractDetail },
  setup(props, { emit }) {
    const type = computed(() => {
      return props.discountType;
    });

    const handleCancel = () => {
      emit("handleCancel");
    };

    const closeAllModal = () => {
      handleCancel();
      emit("closeAllModal");
    };

    return {
      handleCancel,
      closeAllModal,
      type,
    };
  },
});
</script>
